#include <iostream>
#include <string>
#include <stack>

bool g(const std::string& b) {
    std::stack<char> c;
    for (char a : b) {
        switch (a) {
            case '(':
            case '{':
            case '[':
            case '<':
                c.push(a);
                break;
            default:
                if (c.empty()) {
                    return false;
                }
                char d = c.top();
                c.pop();
                if (d == '(' && a != ')') return false;
                if (d == '{' && a != '}') return false;
                if (d == '[' && a != ']') return false;
                if (d == '<' && a != '>') return false;
        }
    }
    return c.empty();
}

int main() {
    std::string a;
    std::getline(std::cin, a);
    if (g(a)) {
        std::cout << "True" << std::endl;
    } else {
        std::cout << "False" << std::endl;
    }
    return 0;
}

